package com.hjj.java.se.objectRep;

import com.thoughtworks.xstream.XStream;

import java.util.*;

public class XmlObjectColMain {
    public static void main(String[] args) {
        int[] counts = {12, 13, 14};
        List<String> phones = new ArrayList<>();
        phones.add("123345");
        phones.add("2345566");
        Map<String, Date> map = new HashMap<>();
        map.put("1", new Date());
        map.put("2", new Date());
        XStream xStream = new XStream();
        XmlObjectCol xmlObjectCol = new XmlObjectCol(counts, phones, map);
        xStream.alias("XmlObjectCol", XmlObjectCol.class);
        String xmlObjectColStr = xStream.toXML(xmlObjectCol);
        System.out.println(xmlObjectColStr);
//        XStream stream = new XStream();
        xStream.alias("XmlObjectCol", XmlObjectCol.class);
        XmlObjectCol xmlObjectCol1 = (XmlObjectCol) xStream.fromXML(xmlObjectColStr);
        System.out.println(xmlObjectCol1);
    }
}
